package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DwWorkMapper;
import com.ruoyi.system.domain.DwWork;
import com.ruoyi.system.service.IDwWorkService;

/**
 * 考核内容Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-01-19
 */
@Service
public class DwWorkServiceImpl implements IDwWorkService 
{
    @Autowired
    private DwWorkMapper dwWorkMapper;

    /**
     * 查询考核内容
     * 
     * @param workId 考核内容主键
     * @return 考核内容
     */
    @Override
    public DwWork selectDwWorkByWorkId(Long workId)
    {
        return dwWorkMapper.selectDwWorkByWorkId(workId);
    }

    /**
     * 查询考核内容列表
     * 
     * @param dwWork 考核内容
     * @return 考核内容
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "su")
    public List<DwWork> selectDwWorkList(DwWork dwWork)
    {
        return dwWorkMapper.selectDwWorkList(dwWork);
    }

    /**
     * 新增考核内容
     * 
     * @param dwWork 考核内容
     * @return 结果
     */
    @Override
    public int insertDwWork(DwWork dwWork)
    {
        dwWork.setCreateTime(DateUtils.getNowDate());
        return dwWorkMapper.insertDwWork(dwWork);
    }

    /**
     * 修改考核内容
     * 
     * @param dwWork 考核内容
     * @return 结果
     */
    @Override
    public int updateDwWork(DwWork dwWork)
    {
        dwWork.setUpdateTime(DateUtils.getNowDate());
        return dwWorkMapper.updateDwWork(dwWork);
    }

    /**
     * 批量删除考核内容
     * 
     * @param workIds 需要删除的考核内容主键
     * @return 结果
     */
    @Override
    public int deleteDwWorkByWorkIds(Long[] workIds)
    {
        return dwWorkMapper.deleteDwWorkByWorkIds(workIds);
    }

    /**
     * 删除考核内容信息
     * 
     * @param workId 考核内容主键
     * @return 结果
     */
    @Override
    public int deleteDwWorkByWorkId(Long workId)
    {
        return dwWorkMapper.deleteDwWorkByWorkId(workId);
    }
}
